import regeneratorRuntime from 'plugins/regenerator-runtime.js'
import * as encapsulation from './utils/encapsulation.js'//数据监控
import { Request_API_CN } from './utils/index.js'
import login from './api/login.js';
import { prefix, surface } from './api/config.js';
let _this
App({
  onLaunch: function (e) {
    _this = this
    if (e.query) {
      this.AID(e.query);
    }
  },
  async AID(e) {
    const Glogin = await login()//登陆
    const Person_a = await encapsulation.addVisitorPerson(e);//访客人数
    const Person_b = await encapsulation.addVisitorFrequency(e);//访客次数
    const Person_c = await encapsulation.shareNumber(e);//通过指定分享进入人数
    Request_API_CN('/currency/login', 'POST', { openid: Glogin.data.data.openid, tablename: surface })//日活
    this.globalData = {
      openid: Glogin.data.data.openid,//OPENID
      AID: Person_a.AID,//存AID，使index能获取到
      SID: Person_c.SID,
      inviterOpenid: e.inviterOpenid ? e.inviterOpenid : (!e.inviterOpenid ? e.scene : '')
    }
  },
  globalData: {}
})